/**

   chunk.h
   =======

   Chunk header

**/


#ifndef CHUNK_H
#define CHUNK_H


/**

   Includes
   --------

   - uuid.h       :  struct uuid
   - chunksrv.h   :  struct chunksrv

**/

#include <uuid.h>
#include "chunksrv.h"


/**

   Constant: CHUNK_REPLICA
   -----------------------

   Number of chunk replica

**/


#define CHUNK_REPLICA          3


/**

   Structure: struct chunk
   -----------------------

   A chunk. Members are:
   - uuid     :  chunk uuid
   - srv      :  chunk servers
   - size     :  effective size, as chunks can be padded with 0
   - next     :  next chunk in linked list
   
**/


struct chunk
{
  struct uuid* uuid;
  struct chunksrv* srv[CHUNK_REPLICA]; 
  uint32_t size;
  struct chunk* next;
};


/**

   Prototypes
   ----------

**/


struct chunk* chunk_create(void);
void chunk_delete(struct chunk* c);


#endif
